﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:local="clr-namespace:SecureBox.Controls;assembly=SecureBox.Controls">
    <Style TargetType="local:ImageTextButtonControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ImageTextButtonControl">
                    <Grid Margin="{StaticResource PhoneTouchTargetOverhang}" toolkit:TiltEffect.IsTiltEnabled="True">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border BorderBrush="White" BorderThickness="0" Opacity="0.9" >
                            <Image Grid.Column="0" Width="{TemplateBinding ImageWidth}" Height="{TemplateBinding ImageHeight}" Source="{TemplateBinding ImageSource}" VerticalAlignment="Top" />
                        </Border>
                        <TextBlock Grid.Column="1" Margin="{TemplateBinding TextMargin}" Text="{TemplateBinding Text}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- RANGE SLIDER -->
    <Style TargetType="local:RangeSlider">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="Black" />
        <Setter Property="Background" Value="#7fffffff" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RangeSlider">
                    <Border Padding="{TemplateBinding Padding}"
                            >
                        <Grid>
                            <Rectangle Fill="#FF424242" VerticalAlignment="Center" Margin="2.5,0,2.5,0" Height="20" StrokeThickness="0" />
                            <Border x:Name="SelectedRangeBorder"
                                    Margin="0" Height="20">
                                <Grid>
                                    <Grid.Resources>
                                        <Style x:Key="EndThumbStyle" TargetType="Thumb">
                                            <Setter Property="Background" Value="#FF1F3B53"/>
                                            <Setter Property="BorderThickness" Value="1"/>
                                            <Setter Property="IsTabStop" Value="False"/>
                                            <Setter Property="BorderBrush">
                                                <Setter.Value>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                        <GradientStop Color="#FF718597" Offset="0.375"/>
                                                        <GradientStop Color="#FF617584" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="Thumb">
                                                        <Grid Background="White" Width="20" Height="20" Margin="-3,-4,-5,-4">
                                                            <VisualStateManager.VisualStateGroups>
                                                                <VisualStateGroup x:Name="CommonStates">
                                                                    <VisualState x:Name="Normal"/>
                                                                    <VisualState x:Name="MouseOver">
                                                                        <Storyboard>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Pressed">
                                                                        <Storyboard>
                                                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                                                                <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
                                                                            </ColorAnimationUsingKeyFrames>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Disabled">
                                                                        <Storyboard>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                </VisualStateGroup>
                                                                <VisualStateGroup x:Name="FocusStates">
                                                                    <VisualState x:Name="Focused">
                                                                        <Storyboard>
                                                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                                                            </DoubleAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState x:Name="Unfocused"/>
                                                                </VisualStateGroup>
                                                            </VisualStateManager.VisualStateGroups>
                                                            <Border x:Name="Background" Background="White" BorderBrush="{TemplateBinding BorderBrush}" Width="20" Height="20">
                                                                <Grid Margin="0" Width="20" Height="20"> <!--d:IsHidden="True">-->
                                                                    <Border x:Name="BackgroundAnimation" Opacity="0" Background="White"/>
                                                                    <Rectangle x:Name="BackgroundGradient" StrokeThickness="0" Fill="White"/>
                                                                </Grid>
                                                            </Border>
                                                            <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" IsHitTestVisible="false" Opacity="0" Margin="0" StrokeThickness="0" Width="20" Height="20"/>
                                                            <Rectangle x:Name="FocusVisualElement" Stroke="White" StrokeThickness="0" Margin="0" IsHitTestVisible="false" Opacity="0" Width="20" Height="20"/>
                                                            <StackPanel Orientation="Horizontal" Margin="0" MaxHeight="10" Width="20" Height="20">
                                                                <Rectangle Width="20" Fill="White" Height="20" StrokeThickness="0" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                                                                <Rectangle Fill="White" Width="20" Margin="1,-5,0,0" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                                                            </StackPanel>
                                                        </Grid>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>

                                    <Thumb x:Name="RangeCenterThumb"
                                           Grid.Column="1"
                                           Cursor="Hand"
                                           Margin="0"
                                           BorderThickness="0" Width="Auto" Height="20" Foreground="#FF3C8ACA" Background="#FF3C8ACA"
                                           >
                                        <Thumb.Style>
                                            <Style TargetType="Thumb">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="Thumb">
                                                            <Grid Background="#FF3C8ACA" Height="20">
                                                                <Border BorderBrush="{TemplateBinding BorderBrush}"
                                                                    BorderThickness="{TemplateBinding BorderThickness}"
                                                                    Background="{TemplateBinding Background}"
                                                                    />
                                                            </Grid>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Thumb.Style>
                                    </Thumb>

                                    <Thumb x:Name="RangeStartThumb" 
                                           Cursor="SizeWE"
                                           Width="20"
                                           Style="{StaticResource EndThumbStyle}"
                                           BorderThickness="{TemplateBinding BorderThickness}" Height="20" Foreground="White" Background="White" BorderBrush="White"
                                           />



                                    <Thumb x:Name="RangeEndThumb"
                                           Grid.Column="2" 
                                           Cursor="SizeWE"
                                           Width="20"
                                           Style="{StaticResource EndThumbStyle}"
                                           BorderBrush="{TemplateBinding BorderBrush}" Height="20" Foreground="White" BorderThickness="0"
                                           />

                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>